package com.automobile.backstage.service.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.automobile.backstage.dao.CarBrandDao;
import com.automobile.backstage.dao.CarTypeDao;
import com.automobile.backstage.dao.CategoryDao;
import com.automobile.backstage.domain.CarBrand;
import com.automobile.backstage.domain.CarType;
import com.automobile.backstage.domain.Category;
import com.automobile.backstage.redis.RedisTemplateUtil;
import com.automobile.backstage.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;


@Service("categoryService")
public class CategoryServiceImpl implements CategoryService {
	
	@Autowired
	private CategoryDao categoryDao;
	
	@Autowired
	@Qualifier("redisTemplateUtil")
	private RedisTemplateUtil<String> redisTemplate;
	
	public List<Category> findCategoryAll() {
		return categoryDao.findCategoryAll();
	}


	@Autowired
	private CarBrandDao carBrandDao;

	public List<CarBrand> findCarBrandAll() {

		return carBrandDao.findCarBrandAll();
	}

	
	@Autowired
	private CarTypeDao carTypeDao;

	public List<CarType> findCarTypeAll() {
		return carTypeDao.findCarTypeAll();
	}

	public int findCategoryIdByName(String name) {
		// TODO Auto-generated method stub
		int id = categoryDao.findIdByName(name);
		return id;
	}

	public int findCarBrandIdByName(String name) {
		// TODO Auto-generated method stub
		int id = carBrandDao.findIdByName(name);
		return id;
	}

	public int findCarTypeIdByName(String name) {
		// TODO Auto-generated method stub
		int id = carTypeDao.findIdByName(name);
		return id;
	}

}
